package com.zz.framework.core.base

import android.view.View
import androidx.annotation.LayoutRes
import com.gyf.immersionbar.ImmersionBar


/**
 * Copyright © 2020 zanezhao All rights reserved.
 * Created by zanezhao on 2020/1/17 6:08 PM.
 * @author: zanezhao 1820022519@qq.com
 * @version: V1.0
 */
open abstract class BaseImmersionBarActivity : BaseUIActivity() {

    fun initImmersionBar() {
        ImmersionBar.with(this).titleBar(toolbarBinding.titleLayout.viewTitle).statusBarDarkFont(true).init();
    }

    public override fun onDestroy() {
        super.onDestroy()
    }

    fun isImmersionBarEnabled(): Boolean {
        return true
    }

    override fun setContentView(@LayoutRes layoutResID: Int) {
        super.setContentView(layoutResID)
        if (isImmersionBarEnabled()) {
            initImmersionBar()
        }
    }

    override fun setContentView(view: View?) {
        super.setContentView(view)
        if (isImmersionBarEnabled()) {
            initImmersionBar()
        }
    }

    open fun initImmersionBarKeyboardEnable() {
        ImmersionBar.with(this).titleBar(toolbarBinding.titleLayout.viewTitle).keyboardEnable(true).statusBarDarkFont(true).init()
    }
}